import { getLocation, getWeather } from '@/api/gaode'
import { weatherKey } from '@/constants/key'

export async function GetLocation(): Promise<{ province: string; city: string; adcode: string }> {
  const { data } = await getLocation()
  return {
    province: data.province,
    city: data.city,
    adcode: data.adcode
  }
}
export async function GetWeather(): Promise<any> {
  const params = await GetLocation()
  const { data } = await getWeather(weatherKey, params.adcode)
  return data.lives[0]
}
